package com.witframework.util;

import java.util.Date;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

public class PrintObject {
	public static String printMapInList(List<Map> data){
		StringBuffer sb=new StringBuffer("List={");
		for(Map map:data){
			sb.append(printMap(map));
		}
		sb.append("}");
		return sb.toString();
	}
	public static String printObjectInList(List<Object> data){
		StringBuffer sb=new StringBuffer("List={");
		for(Object obj:data){
			sb.append(obj.toString()+";");
		}
		sb.append("}");
		return sb.toString();
	}
	public static String printMap(Map map){
		StringBuffer sb=new StringBuffer("Map={");
		Iterator itor=map.keySet().iterator();
		while(itor.hasNext()){
			String key=(String)itor.next();
			Object value=map.get(key);
			if(value instanceof Date){
				sb.append(key+"="+DateUtil.convertDateToString((Date)value));
			}else{
				sb.append(key+"="+value);
			}
			sb.append(";");
		}
		sb.append("}");
		return sb.toString();
	}
}
